﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;

namespace IHISCETeim.Web.MachineSys
{
    public partial class SAPAgentListLookUp : PageBase
    {
        #region 属性 (查询条件)
        protected string target
        {
            get
            {
                return GetRequestValue<string>("target", "");
            }
        }
        protected string rel
        {
            get
            {
                return GetRequestValue<string>("rel", "UAgentMacStockAdd");
            }
        }
        protected override string orderField
        {
            get
            {
                return string.IsNullOrEmpty(base.orderField) ? "AgentName" : base.orderField;
            }
        }
        protected override string orderDirection
        {
            get
            {
                return string.IsNullOrEmpty(base.orderDirection) ? "Asc" : base.orderDirection;
            }
        }

        protected string AgentName
        {
            get
            {
                return GetRequestValue<string>("AgentName","");

            }
        }

      
        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            DataBind();
        }

        protected void DataBind()
        {
            DataTable dt = SBOController.GetAgentList();
            if (string.IsNullOrEmpty(AgentName))
            {
                this.rpMenu.DataSource = dt;
                this.rpMenu.DataBind();
            }
            else
            {
                DataRow[] DRS = dt.Select(" CardName like '%" + AgentName + "%'");
                if (DRS.Count() > 0)
                {
                    this.rpMenu.DataSource = DRS.CopyToDataTable();
                    this.rpMenu.DataBind();
                }
            }
           
        }

        protected override string DWZRef
        {
            get { return ""; }
        }
    }
}